/**
 * 项目名称:
 *
 * @Author: 夏国倩
 * @Date: 2023/9/16 16:39
 * @Copyright
 */
package QuickHit;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Scanner;
public class Player1 extends Player {
    @Override
    public void play(GameTest gameTest) {
        Scanner sc = new Scanner(System.in);
        System.out.println("游戏开始");
        to:
        for (int i = 0; i < LevelParam.levels.length; i++) {
            LocalDateTime localDate = LocalDateTime.now();
            gameTest.getPlayer().setCurScore(0);
            for (int i1 = 0; i1 < LevelParam.levels[i].getStrTimes(); i1++) {
                LocalDateTime localDate1 = LocalDateTime.now();
                Duration between = Duration.between(localDate, localDate1);
                if (LevelParam.levels[i].getTimeLimit() > between.toMillis() / 1000) {
                    String s = gameTest.printStr();
                    System.out.print("请输入：");
                    String s1 = sc.next();
                    gameTest.printResult(s, s1, i, (int) (between.toMillis() / 1000));
                } else {
                    System.out.println(between.toMillis()/1000);
                    System.out.println("超时了");
                    System.exit(1);
                }
            }
        }
    }
}
